﻿using System;
using System.Linq;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

using System.Collections.Generic;
using Kaiser.ModelValidation.Attributes;

namespace Kaiser.Models.InputModels
{
    public class UserInputAdd : UserInput
    {
        public UserInputAdd() { }
        public UserInputAdd(Guid userGroupID
            , UserStatus status
            , string username
            , string displayName
            , string email
            , string password
            , string passwordConfirm
            , IEnumerable<Guid> roles
            , IEnumerable<Guid> permissions
            )
            : base(null, userGroupID, status, username, displayName, email, roles, permissions)
        {
            Password = password;
            PasswordConfirm = passwordConfirm;
        }
        [Required(ErrorMessage = "登录密码不能为空")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "登录密码请保持在6-20个字符之间")]
        [DataType(DataType.Password)]
        [DisplayName("登录密码")]
        public string Password { get; set; }

        [Required(ErrorMessage = "确认密码不能为空")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "确认密码请保持在6-20个字符之间")]
        [Compare("Password", ValidationCompareOperator.Equal, ValidationDataType.String, ErrorMessage = "请确认两次输入的密码一致")]
        [DataType(DataType.Password)]
        [DisplayName("确认密码")]
        public string PasswordConfirm { get; set; }

    }
}
